/**
 * 首页
 * guanf add
 * 2022-11-01
 */
import React from 'react';
import storage from '../Utils/storage'
import $http from '../Utils/request'

let config = {}
if(storage.get("token") !== null){
  config = {
    headers:
      {'Content-Type': 'application/json',
        'token':storage.get("token").data
      }
  }
}else{
  config = {
    headers:
      {'Content-Type': 'application/json'
      }
  }
}

//app路由
function Home() {
    $http.post('http://localhost/mall-basic-service/login/jwt/login/getUser',null,config).then((response)=>{
      if(response.data.code === 200){
        storage.set("userObj",response.data.data);
      }
    })
    return (
        <div className='userDivStyle'>
                欢迎 <label className='userLableStyle'> {storage.get("userObj")!== null ?  storage.get("userObj").nickname : ''}</label>登录系统
        </div>
    )
}

export default Home;
